package com.spring.dao;

import com.spring.pojo.SysModule;
import com.spring.pojo.SysUser;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author 67030
 */
public interface UserDao {


    /** 搜索用户数据
     * @param params 用户名 密码
     * @return 用户对象
     */
    @SelectProvider(type = UserDynaSqlProvider.class ,method = "login")
    public SysUser selectByNameAndPwd(Map<String, Object> params);

    /**插入用户记录
     * @param params 用户名 密码
     * @return 用户对象
     */
    @InsertProvider(type= UserDynaSqlProvider.class,method ="register")
    public SysUser insertNewUser(Map<String,Object> params);

    /** 查询用户是否存在
     * @param userCode 要查询的账户名
     * @return 用户对象
     */
    @SelectProvider(type=UserDynaSqlProvider.class,method = "isExist")
    public SysUser isExistByCode(String userCode);

    /**
     * @param name 用户昵称
     * @return 取同一个名字的用户列表
     */
    @SelectProvider(type=UserDynaSqlProvider.class,method = "selectUsers")
    public List<SysUser> selectUsersByName(String name);

    /**
     * @param params
     * @return
     */
    @UpdateProvider(type=UserDynaSqlProvider.class,method="updateUserInfo")
    public int updateUserInfo(Map<String,Object> params);
}
